home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / views / PrintSelection.as < prev    next >
Encoding:
Text File  |  2008-05-21  |  11.2 KB  |  355 lines

  1. package views
  2. {
  3.    import flash.accessibility.*;
  4.    import flash.debugger.*;
  5.    import flash.display.*;
  6.    import flash.errors.*;
  7.    import flash.events.*;
  8.    import flash.external.*;
  9.    import flash.filters.*;
  10.    import flash.geom.*;
  11.    import flash.media.*;
  12.    import flash.net.*;
  13.    import flash.printing.*;
  14.    import flash.profiler.*;
  15.    import flash.system.*;
  16.    import flash.text.*;
  17.    import flash.ui.*;
  18.    import flash.utils.*;
  19.    import flash.xml.*;
  20.    import mx.binding.*;
  21.    import mx.containers.HBox;
  22.    import mx.containers.TitleWindow;
  23.    import mx.containers.VBox;
  24.    import mx.controls.Button;
  25.    import mx.controls.Image;
  26.    import mx.core.UIComponentDescriptor;
  27.    import mx.core.mx_internal;
  28.    import mx.events.CloseEvent;
  29.    import mx.events.PropertyChangeEvent;
  30.    import mx.managers.PopUpManager;
  31.    import mx.styles.*;
  32.    
  33.    public class PrintSelection extends TitleWindow
  34.    {
  35.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  36.       
  37.       private var _bindings:Array;
  38.       
  39.       [Bindable]
  40.       private var _607087477_Image1:Image;
  41.       
  42.       public var _bindingsByDestination:Object;
  43.       
  44.       private var _documentDescriptor_:UIComponentDescriptor;
  45.       
  46.       [Bindable]
  47.       private var _55416021leftBtn:Button;
  48.       
  49.       [Bindable]
  50.       private var _69177115bothBtn:Button;
  51.       
  52.       public var _bindingsBeginWithWord:Object;
  53.       
  54.       [Bindable]
  55.       private var _1423340355oCreator:MyPrintJob;
  56.       
  57.       [Bindable]
  58.       private var _859611628imageURL:String;
  59.       
  60.       [Bindable]
  61.       private var _1436107104rightBtn:Button;
  62.       
  63.       private var _watchers:Array;
  64.       
  65.       public function PrintSelection()
  66.       {
  67.          _documentDescriptor_ = new UIComponentDescriptor({
  68.             "type":TitleWindow,
  69.             "propertiesFactory":function():Object
  70.             {
  71.                return {"childDescriptors":[new UIComponentDescriptor({
  72.                   "type":VBox,
  73.                   "stylesFactory":function():void
  74.                   {
  75.                      this.horizontalAlign = "center";
  76.                   },
  77.                   "propertiesFactory":function():Object
  78.                   {
  79.                      return {"childDescriptors":[new UIComponentDescriptor({
  80.                         "type":Image,
  81.                         "id":"_Image1",
  82.                         "propertiesFactory":function():Object
  83.                         {
  84.                            return {
  85.                               "width":380,
  86.                               "height":245
  87.                            };
  88.                         }
  89.                      }),new UIComponentDescriptor({
  90.                         "type":HBox,
  91.                         "stylesFactory":function():void
  92.                         {
  93.                            this.horizontalGap = 40;
  94.                         },
  95.                         "propertiesFactory":function():Object
  96.                         {
  97.                            return {
  98.                               "y":255,
  99.                               "width":380,
  100.                               "childDescriptors":[new UIComponentDescriptor({
  101.                                  "type":Button,
  102.                                  "id":"leftBtn",
  103.                                  "events":{"click":"__leftBtn_click"},
  104.                                  "propertiesFactory":function():Object
  105.                                  {
  106.                                     return {
  107.                                        "label":"Left",
  108.                                        "width":100
  109.                                     };
  110.                                  }
  111.                               }),new UIComponentDescriptor({
  112.                                  "type":Button,
  113.                                  "id":"bothBtn",
  114.                                  "events":{"click":"__bothBtn_click"},
  115.                                  "propertiesFactory":function():Object
  116.                                  {
  117.                                     return {
  118.                                        "label":"Both",
  119.                                        "width":100
  120.                                     };
  121.                                  }
  122.                               }),new UIComponentDescriptor({
  123.                                  "type":Button,
  124.                                  "id":"rightBtn",
  125.                                  "events":{"click":"__rightBtn_click"},
  126.                                  "propertiesFactory":function():Object
  127.                                  {
  128.                                     return {
  129.                                        "label":"Right",
  130.                                        "width":100
  131.                                     };
  132.                                  }
  133.                               })]
  134.                            };
  135.                         }
  136.                      })]};
  137.                   }
  138.                })]};
  139.             }
  140.          });
  141.          super();
  142.          mx_internal::_document = this;
  143.          if(!this.styleDeclaration)
  144.          {
  145.             this.styleDeclaration = new CSSStyleDeclaration();
  146.          }
  147.          this.styleDeclaration.defaultFactory = function():void
  148.          {
  149.             this.horizontalCenter = 0;
  150.             this.verticalCenter = 0;
  151.          };
  152.          this.title = "Which page would you like to print?";
  153.          this.showCloseButton = true;
  154.          this.layout = "absolute";
  155.          this.addEventListener("close",___TitleWindow1_close);
  156.       }
  157.       
  158.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  159.       {
  160.          PrintSelection._watcherSetupUtil = param1;
  161.       }
  162.       
  163.       public function set imageURL(param1:String) : void
  164.       {
  165.          var _loc2_:Object = null;
  166.          _loc2_ = this._859611628imageURL;
  167.          if(_loc2_ !== param1)
  168.          {
  169.             this._859611628imageURL = param1;
  170.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"imageURL",_loc2_,param1));
  171.          }
  172.       }
  173.       
  174.       private function _PrintSelection_bindingExprs() : void
  175.       {
  176.          var _loc1_:* = undefined;
  177.          _loc1_ = "images/large/" + imageURL;
  178.       }
  179.       
  180.       [Bindable(event="propertyChange")]
  181.       public function get oCreator() : MyPrintJob
  182.       {
  183.          return this._1423340355oCreator;
  184.       }
  185.       
  186.       private function clickHandler(param1:Event) : void
  187.       {
  188.          switch(param1.target)
  189.          {
  190.             case leftBtn:
  191.                oCreator.whichPage = "left";
  192.                break;
  193.             case rightBtn:
  194.                oCreator.whichPage = "right";
  195.                break;
  196.             case bothBtn:
  197.                oCreator.whichPage = "both";
  198.          }
  199.          oCreator.doPrinting();
  200.          closeDialog(null);
  201.       }
  202.       
  203.       [Bindable(event="propertyChange")]
  204.       public function get leftBtn() : Button
  205.       {
  206.          return this._55416021leftBtn;
  207.       }
  208.       
  209.       public function set rightBtn(param1:Button) : void
  210.       {
  211.          var _loc2_:Object = null;
  212.          _loc2_ = this._1436107104rightBtn;
  213.          if(_loc2_ !== param1)
  214.          {
  215.             this._1436107104rightBtn = param1;
  216.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"rightBtn",_loc2_,param1));
  217.          }
  218.       }
  219.       
  220.       private function closeDialog(param1:CloseEvent) : void
  221.       {
  222.          PopUpManager.removePopUp(this);
  223.       }
  224.       
  225.       public function set oCreator(param1:MyPrintJob) : void
  226.       {
  227.          var _loc2_:Object = null;
  228.          _loc2_ = this._1423340355oCreator;
  229.          if(_loc2_ !== param1)
  230.          {
  231.             this._1423340355oCreator = param1;
  232.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"oCreator",_loc2_,param1));
  233.          }
  234.       }
  235.       
  236.       private function _PrintSelection_bindingsSetup() : void
  237.       {
  238.          var binding:Binding = null;
  239.          if(!_bindings)
  240.          {
  241.             _bindings = [];
  242.          }
  243.          if(!_watchers)
  244.          {
  245.             _watchers = [];
  246.          }
  247.          binding = new Binding(this,function():Object
  248.          {
  249.             return "images/large/" + imageURL;
  250.          },function(param1:Object):void
  251.          {
  252.             _Image1.source = param1;
  253.          },"_Image1.source");
  254.          _bindings[0] = binding;
  255.       }
  256.       
  257.       public function __leftBtn_click(param1:MouseEvent) : void
  258.       {
  259.          clickHandler(param1);
  260.       }
  261.       
  262.       public function ___TitleWindow1_close(param1:CloseEvent) : void
  263.       {
  264.          closeDialog(param1);
  265.       }
  266.       
  267.       public function set leftBtn(param1:Button) : void
  268.       {
  269.          var _loc2_:Object = null;
  270.          _loc2_ = this._55416021leftBtn;
  271.          if(_loc2_ !== param1)
  272.          {
  273.             this._55416021leftBtn = param1;
  274.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"leftBtn",_loc2_,param1));
  275.          }
  276.       }
  277.       
  278.       [Bindable(event="propertyChange")]
  279.       public function get imageURL() : String
  280.       {
  281.          return this._859611628imageURL;
  282.       }
  283.       
  284.       [Bindable(event="propertyChange")]
  285.       public function get rightBtn() : Button
  286.       {
  287.          return this._1436107104rightBtn;
  288.       }
  289.       
  290.       public function set bothBtn(param1:Button) : void
  291.       {
  292.          var _loc2_:Object = null;
  293.          _loc2_ = this._69177115bothBtn;
  294.          if(_loc2_ !== param1)
  295.          {
  296.             this._69177115bothBtn = param1;
  297.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"bothBtn",_loc2_,param1));
  298.          }
  299.       }
  300.       
  301.       public function set _Image1(param1:Image) : void
  302.       {
  303.          var _loc2_:Object = null;
  304.          _loc2_ = this._607087477_Image1;
  305.          if(_loc2_ !== param1)
  306.          {
  307.             this._607087477_Image1 = param1;
  308.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_Image1",_loc2_,param1));
  309.          }
  310.       }
  311.       
  312.       public function __rightBtn_click(param1:MouseEvent) : void
  313.       {
  314.          clickHandler(param1);
  315.       }
  316.       
  317.       [Bindable(event="propertyChange")]
  318.       public function get bothBtn() : Button
  319.       {
  320.          return this._69177115bothBtn;
  321.       }
  322.       
  323.       override public function initialize() : void
  324.       {
  325.          var target:PrintSelection = null;
  326.          var watcherSetupUtilClass:Object = null;
  327.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  328.          _PrintSelection_bindingsSetup();
  329.          target = this;
  330.          if(_watcherSetupUtil == null)
  331.          {
  332.             watcherSetupUtilClass = getDefinitionByName("_views_PrintSelectionWatcherSetupUtil");
  333.             watcherSetupUtilClass["init"](null);
  334.          }
  335.          _watcherSetupUtil.setup(this,function(param1:String):*
  336.          {
  337.             return target[param1];
  338.          },_bindings,_watchers);
  339.          super.initialize();
  340.       }
  341.       
  342.       [Bindable(event="propertyChange")]
  343.       public function get _Image1() : Image
  344.       {
  345.          return this._607087477_Image1;
  346.       }
  347.       
  348.       public function __bothBtn_click(param1:MouseEvent) : void
  349.       {
  350.          clickHandler(param1);
  351.       }
  352.    }
  353. }
  354.  
  355.